package com.hsl.housaileibot001.ai.bailing;

import cn.tbox.sdk.TboxClient;
import cn.tbox.sdk.core.exception.TboxClientConfigException;
import cn.tbox.sdk.core.http.HttpClientConfig;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

/**
 * 白凌 SDK 配置
 * 使用统一的 HTTP 客户端配置，支持 HTTP/2 协议
 */
@Configuration
@ConditionalOnProperty(name = "ai2.provider", havingValue = "bailing")
public class BailingConfig {

    @Resource
    private HttpClientConfig bailingHttpClientConfig;

    /**
     * 创建 TboxClient，使用 HTTP/2 协议
     */
    @Bean
    public TboxClient tboxClient() throws TboxClientConfigException {
        return new TboxClient(bailingHttpClientConfig);
    }
}
